<template>
  <el-table
    :data="itemList"
    v-loading="loading"
    element-loading-text="拼命加载中..."
    highlight-current-row
    empty-text="啊哦网络不给力呀"
    stripe
    style="width: 100%"
    @dblclick="li"
  >
    <el-table-column type="index" width="50" />
    <el-table-column prop="name" label="标题" width="600" />
    <el-table-column prop="ar[0].name" label="歌手" width="180" />
    <el-table-column prop="dt" label="时长" />
  </el-table>
</template>

<script>
import { mapState, mapMutations } from "vuex";

export default {
  data(){
    return{
      loading:true
    }
  },
  computed: {
    ...mapState(["playList","playListIndex"]),
  },
  props:['itemList'],
  methods:{
    li:function(row){
      if(this.playList[this.playListIndex].id == 0 || this.playList[this.playListIndex].id != this.itemList[this.playListIndex].id ){
        this.updatePlayList(this.itemList)
        this.upDatePlayListIndex(row.path[2].__vnode.key)
      }else{
        this.upDatePlayListIndex(row.path[2].__vnode.key)
      }
    },
    ...mapMutations(['upDatePlayListIndex','updatePlayList','updatePlayListAdd'])
  },
  watch:{
    itemList:function(to){
      this.loading = false
    }
  }
}
</script>

